package com.itcncp.wechat.app.mini.controller;

import com.itcncp.common.base.BaseController;
import com.itcncp.common.util.DateUtils;
import com.itcncp.wechat.app.common.constant.ApiResult;
import com.itcncp.wechat.app.common.constant.ApiResultConstant;
import com.itcncp.wechat.app.dao.model.ItcsPlazaInfo;
import com.itcncp.wechat.app.rpc.api.ItcsPlazaInfoService;
import com.itcncp.wechat.app.rpc.api.ItcsStationInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 *
 * Created by shuitcncp on 2016/12/10.
 */
@Controller
@RequestMapping("/tollstation")
@Api(tags = "收费站点管理",value = "收费站", description = "收费站信息接口",
        produces = "produces",consumes = "consumes",basePath = "/tollstation")

public class OwnerController extends BaseController {

    private static final Logger LOGGER = LoggerFactory.getLogger( OwnerController.class);

    @Autowired
    private ItcsPlazaInfoService itcsPlazaInfoService;


    @ResponseBody
    @ApiOperation(value="收费站信息列表",notes="一次性将所有的收费站记录全部查出，显示在地图上")
    @RequestMapping(value = "/downTollstation", method = RequestMethod.POST)
    public Object downTollstation(HttpServletRequest request) {

        List<ItcsPlazaInfo> rows = itcsPlazaInfoService.selectOwnerPlazaByCache(DateUtils.dateFormatNow( "YYYYMMDDHH" ));
        Integer total = 0;

        if(rows!=null){
            total = rows.size();
        }


        return new ApiResult( ApiResultConstant.SUCCESS,rows,total);
    }


}